!!!
%html
  %body
    .span15
      .container
        .col-md-12
          .row
            .page-header
              %h1
                Jobs
            .row
              .col-md-10
                Jobs contain a series of tasks (hashcat commands). Jobs also have an associated list of hashes to crack.
              .col-md-2.pull-right
                %a.btn.btn-primary.pull-right{href: '/jobs/create'}
                  Create a New Job
      %br
      %br
      .container
        .row
          .col-md-12
            .table
              %table{class: 'table table-striped'}
                %thead
                  %tr
                    %th
                      %b Customer
                    %th
                      %b Name
                    %th
                      %b Status
                    %th
                      %b Last updated by
                    %th
                      %b Control
                %tbody
                  - if @jobs
                    - @jobs.each do |job|
                      %tr
                        %td #{@customer_names[job.customer_id]}
                        %td #{job.name}
                        - if job.status == 'Running'
                          %td Running
                        - elsif job.status == 'Queued'
                          %td Queued
                        - elsif job.status == 'Completed'
                          %td Completed
                        - elsif job.status == 'Importing'
                          %td Importing
                        - else
                          %td Stopped
                        %td #{job.last_updated_by}
                        %td
                          - if job.status == 'Running'
                            %a.btn.btn-danger{href: "/jobs/stop/#{job.id}"}
                              %i.glyphicon.glyphicon-stop{title: 'Running'}
                          - elsif job.status == 'Queued'
                            %a.btn.btn-default{href: "/jobs/stop/#{job.id}"}
                              %i.glyphicon.glyphicon-hourglass{title: 'Queued'}
                          - elsif job.status == 'Completed'
                            %a.btn.btn-success{href: ''}
                              %i.glyphicon.glyphicon-ok{title: 'Completed'}
                          - elsif job.status == 'Importing'
                            %a.btn.btn-default{href: '/home'}
                              %i.glyphicon.glyphicon-hourglass{title: 'Wait'}
                          - else
                            %a.btn.btn-success{href: "/jobs/start/#{job.id}"}
                              %i.glyphicon.glyphicon-play{title: 'stopped'}
                          %a.btn.btn-primary{href: "/analytics?customer_id=#{job.customer_id}&hashfile_id=#{job.hashfile_id}"}
                            %i.glyphicon.glyphicon-stats{title: 'Display crack stats'}
                          %a.btn.btn-info{href: "#modal#{job.id}", "data-toggle" => 'modal'}
                            %i.glyphicon.glyphicon-info-sign{title: 'Info'}
                          .modal.fade.modal{id: "modal#{job.id}", role: 'dialog', tabindex: '-1', "aria-hidden" => 'true'}
                            .modal-dialog.modal-lg
                              .modal-content
                                .modal-header
                                  %button.close{'aria-label' => 'Close', 'data-dismiss' => 'modal', type: 'button'}
                                    %span{'aria-hidden' => 'true'} &times;
                                  %h4.modal-title Job Tasks for: #{job.name} (id:#{job.id})
                                .modal-body
                                  %p
                                  .table
                                    %table{class: 'table table-striped'}
                                      - if @jobtasks
                                        - @jobtasks.each do |jt|
                                          - if jt.job_id == job.id
                                            - @tasks.each do |task|
                                              - if task.id == jt.task_id
                                                %tr
                                                  %td
                                                    .row
                                                      .form-group
                                                        %label.control-label.col-xs-2{for: ''} Task Name
                                                        .col-xs-10
                                                          #{task.name}
                                                    .row
                                                      .form-group
                                                        %label.control-label.col-xs-2{for: ''} Attack Mode
                                                        .col-xs-4
                                                          #{task.hc_attackmode}
                                                    - if task.hc_attackmode == 'dictionary'
                                                      .row
                                                        .form-group
                                                          %label.control-label.col-xs-2{for: ''} Wordlist
                                                          .col-xs-4
                                                            #{@wordlist_id_to_name[task.wl_id]}
                                                      .row
                                                        .form-group
                                                          %label.control-label.col-xs-2{for: ''} Dictionary Rules
                                                          .col-xs-4
                                                            #{task.hc_rule}
                                      - else
                                        No tasks are assigned to this job
                                  %p
                                .modal-footer
                                  %button.btn.btn-default{"data-dismiss" => "modal", type: 'button'} Close
                          - if job.status == 'Running' || job.status == 'Queued'
                            %a.btn.btn-warning.disabled{href: "/jobs/create?customer_id=#{job.customer_id}&job_id=#{job.id}&edit=1"}
                              %i.glyphicon.glyphicon-cog{title: 'Edit'}
                            %a.btn.btn-danger.disabled{href: "/jobs/delete/#{job.id}"}
                              %i.glyphicon.glyphicon-trash{title: 'Delete'}
                          - else
                            %a.btn.btn-warning{href: "/jobs/create?customer_id=#{job.customer_id}&job_id=#{job.id}&edit=1"}
                              %i.glyphicon.glyphicon-cog{title: 'Edit'}
                            %a.btn.btn-danger{href: "/jobs/delete/#{job.id}"}
                              %i.glyphicon.glyphicon-trash{title: 'Delete'}
